import 'package:flutter/material.dart';

class UnderlineButton extends StatelessWidget {
  final String title;
  final double space;
  final TextStyle? style;
  final bool selected;
  final void Function()? onTap;
  const UnderlineButton(
      {super.key,
      required this.title,
      this.onTap,
      this.space = 2.0,
      this.style,
      this.selected = false});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: EdgeInsets.all(8.0),
        child: Column(
          children: [
            Text(title,
                style: style ??
                    TextStyle(
                        color: selected
                            ? Theme.of(context).primaryColor
                            : Colors.white)),
            Container(
              width: 80,
              padding: EdgeInsets.only(top: space),
              child: Divider(
                height: 1,
                thickness: 1,
                color: selected ? Theme.of(context).primaryColor : Colors.white,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
